home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dialog / dialogjb / dialogjb.frm next >
Encoding:
Text File  |  1995-08-27  |  21.7 KB  |  625 lines

  1. 'This form should work as a Common Dialog box without the use of any
  2. 'VBX's or DLL's.
  3. 'The reading of the INI file is optional but may be useful.
  4. 'The main form is called frmMain here.  Substitute the appropriate name
  5. 'for your program.
  6. 'Please note also the file OpenBtn.TXT which gives the commands on the
  7. 'Main form that should be used whenever this dialog box is opened
  8. '(whether from a Button, a Menu, or whatever command.)
  9. 'This is set up so that the file names are loaded into a Combo Box on the
  10. 'Main form.  This can be easily altered to a list box or to some other
  11. 'device depending on the nature of your main program and whether you
  12. 'want this Common Dialog box to load single files or multiple files.
  13. 'You also, of course, may change color, location of controls, fonts, etc.
  14.  
  15.  
  16. VERSION 2.00
  17. Begin Form frmDialogJB    'Main form like Dialog Box, uses 3D gray shading
  18.    BackColor       =   &H00C0C0C0&
  19.    BorderStyle     =   1  'Fixed Single
  20.    Caption         =   "Select Files" 'Will select more than one file
  21.    ClientHeight    =   4020
  22.    ClientLeft      =   1680
  23.    ClientTop       =   1575
  24.    ClientWidth     =   7365
  25.    ClipControls    =   0   'False
  26.    FontBold        =   0   'False
  27.    FontItalic      =   0   'False
  28.    FontName        =   "MS Sans Serif"
  29.    FontSize        =   8.25
  30.    FontStrikethru  =   0   'False
  31.    FontUnderline   =   0   'False
  32.    Height          =   4425
  33.    HelpContextID   =   200
  34.    Left            =   1620
  35.    LinkTopic       =   "Form1"
  36.    MaxButton       =   0   'False
  37.    MinButton       =   0   'False
  38.    ScaleHeight     =   4020
  39.    ScaleWidth      =   7365
  40.    Top             =   1230
  41.    Width           =   7485
  42. End
  43. 'To save initial directory and hidden/system defaults, you may want to
  44. 'use an INI file. I used INICON.VBX because it was easy. Other VBX's
  45. 'or Windows API calls can be just as effective.
  46.    Begin Init IniSystem 'VBX control to read INI file info on System files
  47.       Application     =   "MyProgram"
  48.       Filename        =   "MYPROGRM.INI"
  49.       Height          =   420
  50.       Left            =   6480
  51.       Parameter       =   "System"
  52.       Top             =   2880
  53.       Value           =   "0"
  54.       Width           =   420
  55.    End
  56.    Begin Init IniHidden 'VBX control to read INI file info on Hidden files
  57.       Application     =   "MyProgram"
  58.       Filename        =   "MYPROGRM.INI"
  59.       Height          =   420
  60.       Left            =   5880
  61.       Parameter       =   "Hidden"
  62.       Top             =   2880
  63.       Value           =   "0"
  64.       Width           =   420
  65.    End
  66.    Begin Init IniDir 'VBX control to read INI file for Initial Directory
  67.       Application     =   "MyProgram"
  68.       Filename        =   "MYPROGRM.INI"
  69.       Height          =   420
  70.       Left            =   5280
  71.       Parameter       =   "InitDir"
  72.       Top             =   2880
  73.       Value           =   "c:\vb"
  74.       Width           =   420
  75.    End
  76.    Begin CommandButton cmdCancelD1 'Control for Cancel button
  77.       BackColor       =   &H00C0C0C0&
  78.       Cancel          =   -1  'True--Routine cancels if ESC key is pressed
  79.       Caption         =   "&Cancel"
  80.       FontBold        =   0   'False
  81.       FontItalic      =   0   'False
  82.       FontName        =   "MS Sans Serif"
  83.       FontSize        =   8.25
  84.       FontStrikethru  =   0   'False
  85.       FontUnderline   =   0   'False
  86.       Height          =   375
  87.       HelpContextID   =   200 'I used Help Context ID's for this
  88. 'You may decide this is optional or may have other ID number
  89.       Left            =   5400
  90.       TabIndex        =   8
  91.       Top             =   720
  92.       Width           =   1095
  93.    End
  94.    Begin CommandButton cmdOKD1 'OK button, loads selected files & returns
  95. 'to main screen
  96.       BackColor       =   &H00C0C0C0&
  97.       Caption         =   "&OK"
  98.       FontBold        =   0   'False
  99.       FontItalic      =   0   'False
  100.       FontName        =   "MS Sans Serif"
  101.       FontSize        =   8.25
  102.       FontStrikethru  =   0   'False
  103.       FontUnderline   =   0   'False
  104.       Height          =   375
  105.       HelpContextID   =   200
  106.       Left            =   5400
  107.       TabIndex        =   7 'Keeping tab index order can be helpful
  108. 'for those not using a mouse
  109.       Top             =   240
  110.       Width           =   1095
  111.    End
  112.    Begin CheckBox ckSystem  'Use check box for indicating whether System
  113. 'files are read by program or not.  If your program never needs to
  114. 'read or load System files, you do not need this.
  115.       BackColor       =   &H00C0C0C0&
  116.       Caption         =   "Show System Files"
  117.       FontBold        =   0   'False
  118.       FontItalic      =   0   'False
  119.       FontName        =   "MS Sans Serif"
  120.       FontSize        =   8.25
  121.       FontStrikethru  =   0   'False
  122.       FontUnderline   =   0   'False
  123.       Height          =   375
  124.       HelpContextID   =   550
  125.       Left            =   5400
  126.       TabIndex        =   6
  127.       Top             =   2040
  128.       Width           =   1695
  129.    End
  130.    Begin CheckBox ckHidden 'Use check box for indicating whether Hidden
  131. 'files are read by program or not.  If your program never needs to
  132. 'read or load Hidden files, you do not need this.
  133.       BackColor       =   &H00C0C0C0&
  134.       Caption         =   "Show Hidden Files"
  135.       FontBold        =   0   'False
  136.       FontItalic      =   0   'False
  137.       FontName        =   "MS Sans Serif"
  138.       FontSize        =   8.25
  139.       FontStrikethru  =   0   'False
  140.       FontUnderline   =   0   'False
  141.       Height          =   375
  142.       HelpContextID   =   550
  143.       Left            =   5400
  144.       TabIndex        =   5
  145.       Top             =   1560
  146.       Width           =   1695
  147.    End
  148.    Begin DriveListBox Drive1 'Drive list box to show which drive you want
  149. 'to use. Found in nearly all file dialog boxes.
  150.       FontBold        =   0   'False
  151.       FontItalic      =   0   'False
  152.       FontName        =   "MS Sans Serif"
  153.       FontSize        =   8.25
  154.       FontStrikethru  =   0   'False
  155.       FontUnderline   =   0   'False
  156.       Height          =   315
  157.       HelpContextID   =   200
  158.       Left            =   2880
  159.       TabIndex        =   4
  160.       Top             =   3240
  161.       Width           =   2055
  162.    End
  163.    Begin DirListBox Dir1 'Directory list box to choose which directory
  164. 'you want to read or load files from
  165.       FontBold        =   0   'False
  166.       FontItalic      =   0   'False
  167.       FontName        =   "MS Sans Serif"
  168.       FontSize        =   8.25
  169.       FontStrikethru  =   0   'False
  170.       FontUnderline   =   0   'False
  171.       Height          =   1605
  172.       HelpContextID   =   200
  173.       Left            =   2880
  174.       TabIndex        =   3
  175.       Top             =   960
  176.       Width           =   2055
  177.    End
  178.    Begin FileListBox File1 'List Box for files to read or load
  179.       FontBold        =   0   'False
  180.       FontItalic      =   0   'False
  181.       FontName        =   "MS Sans Serif"
  182.       FontSize        =   8.25
  183.       FontStrikethru  =   0   'False
  184.       FontUnderline   =   0   'False
  185.       Height          =   2565
  186.       HelpContextID   =   200
  187.       Left            =   360
  188.       MultiSelect     =   2  'Extended. This can be an important switch.
  189. 'Check Visual Basic Manual for three options--choose one file only or
  190. 'two ways to select more than one file. The "Extended" mode is commonly
  191. 'used in programs which load or read more than one file at a time (like
  192. 'the Windows File Manager).
  193.       TabIndex        =   1 'Note that the Tab Index #1 should be set for
  194. 'this list box since this is the one most likely to be used.
  195.       Top             =   960
  196.       Width           =   2055
  197.    End
  198.    Begin TextBox Text1 'Use Text Box so user can enter name of file
  199. 'to load. Will also show file or first of group of files selected.
  200.       FontBold        =   0   'False
  201.       FontItalic      =   0   'False
  202.       FontName        =   "MS Sans Serif"
  203.       FontSize        =   8.25
  204.       FontStrikethru  =   0   'False
  205.       FontUnderline   =   0   'False
  206.       Height          =   285
  207.       HelpContextID   =   200
  208.       Left            =   360
  209.       TabIndex        =   0
  210.       Text            =   "*.*" 'Standard default file name in Text box
  211.       Top             =   480
  212.       Width           =   2055
  213.    End
  214.    Begin Label lblCk 'Label by Check boxes for Hidden & System files
  215. 'Not needed if your program never uses Hidden or System files
  216.       BackColor       =   &H00C0C0C0&
  217.       Caption         =   "Show Files:"
  218.       FontBold        =   0   'False
  219.       FontItalic      =   0   'False
  220.       FontName        =   "MS Sans Serif"
  221.       FontSize        =   8.25
  222.       FontStrikethru  =   0   'False
  223.       FontUnderline   =   0   'False
  224.       Height          =   255
  225.       Left            =   5400
  226.       TabIndex        =   12
  227.       Top             =   1200
  228.       Width           =   855
  229.    End
  230.    Begin Label lblDrive  'Label by Drive List Box
  231.       BackColor       =   &H00C0C0C0&
  232.       Caption         =   "Drives:"
  233.       FontBold        =   0   'False
  234.       FontItalic      =   0   'False
  235.       FontName        =   "MS Sans Serif"
  236.       FontSize        =   8.25
  237.       FontStrikethru  =   0   'False
  238.       FontUnderline   =   0   'False
  239.       Height          =   255
  240.       Left            =   2880
  241.       TabIndex        =   11
  242.       Top             =   2880
  243.       Width           =   495
  244.    End
  245.    Begin Label lblDirTop 'Label at top of Directory list box
  246.       BackColor       =   &H00C0C0C0&
  247.       Caption         =   "Directories:"
  248.       FontBold        =   0   'False
  249.       FontItalic      =   0   'False
  250.       FontName        =   "MS Sans Serif"
  251.       FontSize        =   8.25
  252.       FontStrikethru  =   0   'False
  253.       FontUnderline   =   0   'False
  254.       Height          =   255
  255.       Left            =   2880
  256.       TabIndex        =   10
  257.       Top             =   120
  258.       Width           =   855
  259.    End
  260.    Begin Label lblFile 'Label by File List Box
  261.       BackColor       =   &H00C0C0C0&
  262.       Caption         =   "File Names:"
  263.       FontBold        =   0   'False
  264.       FontItalic      =   0   'False
  265.       FontName        =   "MS Sans Serif"
  266.       FontSize        =   8.25
  267.       FontStrikethru  =   0   'False
  268.       FontUnderline   =   0   'False
  269.       Height          =   255
  270.       Left            =   360
  271.       TabIndex        =   9
  272.       Top             =   120
  273.       Width           =   855
  274.    End
  275. 'The following shapes add 3D effect to gray color of dialog box according to
  276. 'more recent Windows fashion (including Windows 95). See cover story of
  277. 'March 1995 Visual Basic Programmer's Journal.
  278.    Begin Shape rctCkW 
  279.       BorderColor     =   &H00FFFFFF&
  280.       Height          =   1335
  281.       Left            =   5295
  282.       Top             =   1335
  283.       Width           =   1935
  284.    End
  285.    Begin Shape rctDriveW 
  286.       BorderColor     =   &H00FFFFFF&
  287.       Height          =   735
  288.       Left            =   2775
  289.       Top             =   3015
  290.       Width           =   2295
  291.    End
  292.    Begin Shape rctDirW 
  293.       BorderColor     =   &H00FFFFFF&
  294.       Height          =   2535
  295.       Left            =   2775
  296.       Top             =   255
  297.       Width           =   2295
  298.    End
  299.    Begin Shape rctFileW 
  300.       BorderColor     =   &H00FFFFFF&
  301.       Height          =   3495
  302.       Left            =   255
  303.       Top             =   255
  304.       Width           =   2295
  305.    End
  306.    Begin Shape rctCkG 
  307.       BorderColor     =   &H00808080&
  308.       Height          =   1335
  309.       Left            =   5280
  310.       Top             =   1320
  311.       Width           =   1935
  312.    End
  313.    Begin Shape rctDriveG 
  314.       BorderColor     =   &H00808080&
  315.       Height          =   735
  316.       Left            =   2760
  317.       Top             =   3000
  318.       Width           =   2295
  319.    End
  320.    Begin Label lblDirName 'Label shows directory selected. Use label
  321. 'in conjunction with list box. Unlike Text box with file name, user
  322. 'does not enter name of directory. (User may put directory in Text box.) 
  323.       BackColor       =   &H00E0E0E0&
  324.       BorderStyle     =   1  'Fixed Single
  325.       FontBold        =   0   'False
  326.       FontItalic      =   0   'False
  327.       FontName        =   "MS Sans Serif"
  328.       FontSize        =   8.25
  329.       FontStrikethru  =   0   'False
  330.       FontUnderline   =   0   'False
  331.       Height          =   255
  332.       Left            =   2880
  333.       TabIndex        =   2
  334.       Top             =   480
  335.       Width           =   2055
  336.    End
  337. 'More 3D highlighting
  338.    Begin Shape rctDirG 
  339.       BackColor       =   &H00C0C0C0&
  340.       BorderColor     =   &H00808080&
  341.       Height          =   2535
  342.       Left            =   2760
  343.       Top             =   240
  344.       Width           =   2295
  345.    End
  346.    Begin Shape rctFileG 
  347.       BorderColor     =   &H00808080&
  348.       Height          =   3495
  349.       Left            =   240
  350.       Top             =   240
  351.       Width           =   2295
  352.    End
  353. End
  354. Option Explicit
  355. Dim DrNm$ 'Set String name for directory to read
  356. 'As stated before, you may use another method of reading INI file if you
  357. 'need to.  Just change code as needed.
  358.  
  359. Sub ckHidden_Click ()
  360. Dim Hidyes% 'Set Integer (Boolean, T-F) for whether Hidden Files are read
  361. If CkHidden.Value = 1 Then 'If you click the Hidden Box on then INI file 
  362. 'value is changed to reflect this
  363.     IniHidden.Filename = "MYPROGRM.INI"   'Reads INI file value
  364.     IniHidden.Application = "MyProgram"
  365.     IniHidden.Parameter = "Hidden"
  366.     IniHidden.Value = True   'When INI file value is true, then File Box reads 
  367.                                'Hidden Files
  368.     File1.Hidden = True
  369. Else  'That is, if the Hidden box is not checked...
  370.     File1.Hidden = False  'INI value is false, and File Box skips Hidden Files
  371.     IniHidden.Filename = "MYPROGRM.INI"
  372.     IniHidden.Application = "MyProgram"
  373.     IniHidden.Parameter = "Hidden"
  374.     IniHidden.Value = False
  375. End If
  376.  
  377. End Sub
  378.  
  379. Sub ckSystem_Click ()
  380. Dim Sysyes% 'Set integer (Boolean, T-F) whether or System files are read
  381. If CkSystem.Value = 1 Then 'If user checks the System box...
  382.     IniSystem.Filename = "MYPROGRM.INI"
  383.     IniSystem.Application = "MyProgram"
  384.     IniSystem.Parameter = "System"
  385.     IniSystem.Value = True 'then INI file is changed and
  386.     File1.System = True 'System files are read.
  387. Else 'If System check box is unchecked...
  388.     File1.System = False 'System files are not longer listed
  389.     IniSystem.Filename = "MYPROGRM.INI"
  390.     IniSystem.Application = "MyProgram"
  391.     IniSystem.Parameter = "System"
  392.     IniSystem.Value = False 'and INI file is changed to reflect this.
  393. End If
  394. End Sub
  395.  
  396. Sub cmdCancelD1_Click ()
  397.     Unload frmDialogJB
  398.     frmMain.LinShadB.Visible = False 'When dialog box is unloaded,
  399. 'the shaded line which appears over the main Window to give a 3D shaded
  400. 'effect is also closed
  401. End Sub
  402.  
  403. Sub cmdOKD1_Click ()
  404. 'The OK button as with standard dialog normally sends files to main program.
  405. Dim I As Integer, FN  As String 'FN is the File name, I is for the loop
  406. 'First do an error check to make sure a file has been loaded.
  407. 'If text box is either empty or has the original asterisks, nothing
  408. 'is done and nothing happens.
  409. If Text1.Text <> "*.*" And Len(Text1.Text) > 0 Then GoTo Loadfiles
  410.    Dir1_Change
  411.    Exit Sub
  412. Loadfiles:
  413. P$ = File1.Path 'Makes a simpler name for the file box path
  414. 'Check for files entered from text box but not file box
  415. Dim Selcount As Integer
  416. Selcount = 0
  417. For I = 0 To File1.ListCount - 1
  418.     If File1.Selected(I) Then
  419.         Selcount = Selcount + 1
  420.     End If
  421. Next I
  422.     If Selcount = 0 Then 'If item was manually entered into text box,
  423. 'this sends item to combo box in main program.  Clearly, you may
  424. 'choose to use a list box in your main program instead, or you may
  425. 'have some other way of loading the file, especially if you are only
  426. 'using single files.  
  427.         frmMain.cboFile.AddItem Text1.Text
  428.         GoTo Morefile:
  429.     End If
  430.  
  431. 'Add Selected files to frmMain.cboFile
  432. 'This adds multiple files to the combo box in your main program
  433. For I = 0 To File1.ListCount - 1
  434.     If File1.Selected(I) Then
  435.         frmMain.cboFile.AddItem File1.List(I)
  436.     End If
  437. Next I
  438. Morefile:
  439. 'This adds the path name to the main program.
  440. 'It must filter the various ways the directory and drive may be read.
  441. 'This insures that there is backslash between the directory and file name.
  442.     frmMain.cboFile.ListIndex = 0
  443.     If Right(File1.Path, 1) <> "\" Then
  444.         FN = File1.Path + "\" + frmMain.cboFile.List(0)
  445.     Else
  446.         FN = File1.Path + frmMain.cboFile.List(0)
  447.     End If
  448.     Unload frmDialogJB
  449.     frmMain.LinShadB.Visible = False  'See note by Cancel command
  450.  
  451. 'Add commands as necessary for main program Window
  452. End Sub
  453.  
  454. Sub Dir1_Change ()
  455. 'Handles changes user makes to directory list box
  456. If Dir1.Path <> Dir1.List(Dir1.ListIndex) Then
  457.     Dir1.Path = Dir1.List(Dir1.ListIndex)
  458. End If
  459.     DrNm$ = Dir1.Path
  460.     lblDirname = DrNm$
  461.     File1.Path = DrNm$
  462. End Sub
  463.  
  464. Sub Dir1_KeyPress (KeyAscii As Integer)
  465. 'If user presses Enter while in Directory List Box, change is made
  466. If KeyAscii = 13 Then
  467.     If Dir1.Path <> Dir1.List(Dir1.ListIndex) Then
  468.         Dir1.Path = Dir1.List(Dir1.ListIndex)
  469.     End If
  470.     DrNm$ = Dir1.Path
  471.     lblDirname = DrNm$
  472.     File1.Path = DrNm$
  473. End If
  474.  
  475. End Sub
  476.  
  477. Sub Drive1_Change ()
  478. 'Changes drive, and checks to make sure drive is present or functioning
  479. On Error GoTo ErrCheck
  480.     Dir1.Path = Drive1.Drive
  481.     Exit Sub
  482. ErrCheck:
  483.     MsgBox "Drive Error!", 48, "MyProgram Error"
  484.     Exit Sub
  485.  
  486. End Sub
  487.  
  488. Sub File1_Click ()
  489. 'A single click on a file name in the file list box enters the file name
  490. 'into the text box
  491.    Text1 = File1.FileName
  492. End Sub
  493.  
  494. Sub File1_DblClick ()
  495. 'A double click on a file name in the file list box enters the file name
  496. 'into the text box and loads or reads the file
  497.     Text1 = File1.FileName
  498.     cmdOKD1_Click
  499. End Sub
  500.  
  501. Sub File1_KeyPress (KeyAscii As Integer)
  502. 'Pressing Enter after choosing a file in the file List box also loads
  503. 'or reads that file
  504.     If KeyAscii = 13 Then File1_DblClick
  505. End Sub
  506.  
  507. Sub Form_Load ()
  508. 'When form loads, it reads from the INI file to see three things:
  509. 'The initial directory, and whether System and Hidden files are read.
  510. 'I used the INICON.VBX system, you may use another VBX or the Windows API
  511. 'to get the same result.  Clearly, if you don't need any of these items,
  512. 'you don't have to have this part. 
  513. Dim InDir$, Sisyes%, Hidyes%          
  514.     CenterForm frmDialogJB 'If you have a routine for centering the form
  515. 'then use it
  516.     frmDialogJB.Show
  517. 'Reads INI to see if System file check box is checked and System files
  518. 'Are being read.
  519.     IniSystem.Filename = "MYPROGRM.INI"
  520.     IniSystem.Application = "MyProgram"
  521.     IniSystem.Parameter = "System"
  522.     Sisyes% = IniSystem.Value
  523. If Sisyes% = True Then
  524.     File1.System = True
  525.     CkSystem.Value = 1
  526. Else
  527.     File1.System = False
  528.     CkSystem.Value = 0
  529. End If
  530. 'Reads INI to see if Hidden File check box is checked and Hidden files
  531. 'are being read
  532.     IniHidden.Filename = "MYPROGRM.INI"
  533.     IniHidden.Application = "MyProgram"
  534.     IniHidden.Parameter = "Hidden"
  535.     Hidyes% = IniHidden.Value
  536. If Hidyes% = True Then
  537.     File1.Hidden = True
  538.     CkHidden.Value = 1
  539. Else
  540.     File1.Hidden = False
  541.     CkHidden.Value = 0
  542. End If
  543. 'Read INI file for Initial Directory and sets Directory and Drive list
  544. 'boxes to the appropriate drive and directory
  545.     IniDir.Filename = "MYPROGRM.INI"
  546.     IniDir.Application = "MyProgram"
  547.     IniDir.Parameter = "InitDir"
  548.     InDir$ = IniDir.Value
  549. Drive1.Drive = InDir$
  550. Dir1.Path = InDir$
  551. File1.Path = InDir$
  552. lblDirname = InDir$
  553. File1.FileName = ""
  554. End Sub
  555.  
  556. Sub Form_Paint ()
  557. 'This adds 3D shading to Text Boxes, Outlined Labels, and List Boxes
  558.     Call BordGray3d(frmDialogJB)
  559.     Call Go3dGray(frmDialogJB, Text1)
  560.     Call Go3dGray(frmDialogJB, File1)
  561.     Call Go3dGray(frmDialogJB, lblDirname)
  562.     Call Go3dGray(frmDialogJB, Dir1)
  563.     Call Go3dGray(frmDialogJB, Drive1)
  564. End Sub
  565. 'Error filters for text entered in box so that file name is legal
  566. 'And inadvertent insertions are avoided
  567. Sub Text1_KeyDown (KeyCode As Integer, Shift As Integer)
  568.     If KeyCode = 45 And (Shift And 1) = 1 Then KeyCode = 0
  569. End Sub
  570.  
  571. Sub Text1_KeyPress (KeyAscii As Integer)
  572. If KeyAscii = 13 Then GoTo Enter 'If Enter key is pressed, action continues
  573. If KeyAscii = 22 Then KeyAscii = 0
  574. If KeyAscii < Asc(" ") Then Exit Sub
  575. If KeyAscii = Asc(".") Then GoTo Period
  576. If KeyAscii > 42 And KeyAscii < 45 Then KeyAscii = 0
  577. If KeyAscii = 47 Then KeyAscii = 0
  578. If KeyAscii > 57 And KeyAscii < 64 Then KeyAscii = 0
  579. If KeyAscii > 90 And KeyAscii < 94 Then KeyAscii = 0
  580. If KeyAscii = 124 Then KeyAscii = 0
  581.  
  582. Period:     'Check for more than one period
  583. Dim Periods%, Length%, I%
  584. Periods% = 0
  585. Length% = Len(Text1.Text)
  586. For I% = 1 To Length%
  587.     If Mid$(Text1.Text, I%, 1) = "." Then
  588.         Periods% = Periods% + 1
  589.     End If
  590. Next I%
  591. If Periods% >= 1 Then KeyAscii = 0
  592.  
  593. 'You may need the following keys filtered also
  594. If KeyAscii >= Asc("0") Or KeyAscii <= Asc("9") Then GoTo OVR1
  595. If KeyAscii > 124 Then GoTo OVR1
  596. If KeyAscii > 35 And KeyAscii < 42 Then GoTo OVR1:
  597. If KeyAscii = 33 Then GoTo OVR1
  598. If KeyAscii > 63 And KeyAscii < 91 Then GoTo OVR1
  599. If KeyAscii > 93 And KeyAscii < 124 Then GoTo OVR1
  600. OVR1:
  601. 'Include other conditions as necessary
  602.      If Text1.SelLength = CLng(0) And KeyAscii >= 32 Then
  603.         Text1.SelLength = CLng(1)
  604.         End If
  605.    ' End If 'If other conditions
  606. Exit Sub
  607. Enter:
  608. 'Enters file or files into main program
  609. Dim FN As String
  610.     P$ = File1.Path
  611.     frmMain.cboFile.AddItem Text1.Text
  612.     frmMain.cboFile.ListIndex = 0
  613.     If Right(File1.Path, 1) <> "\" Then
  614.         FN = File1.Path + "\" + frmMain.cboFile.List(0)
  615.     Else
  616.         FN = File1.Path + frmMain.cboFile.List(0)
  617.     End If
  618. 'Add other information to main program as necessary
  619.  
  620.     Unload frmDialogJB
  621.     frmMain.LinShadB.Visible = False
  622. End Sub
  623.  
  624.  
  625.